package com.example.a79273.shandianban.model;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/8/29.
 */
public class StyleBean {

    /**
     * error_code : 0
     * error_msg : 获取数据成功
     * total : 2
     * data : {"lists":[{"pic_id":"236000170128","pic_gender":"女装",
     * "pic_scr":"/Upload/Product/236000170128/36f2b4d035.jpg",
     * "pic_url":"api/Customization/GetDetail/236000170128",
     * "pic_title":"「Ur-color」拼接色开衫定制","htmldetail":"<html><body
     * style='margin:0'><img src='http://www.sdb330
     * .com//Upload/Product/236000170128/36f2b4d072.jpg' hidefocus='true'
     * style='width:100%' /><\/body><\/html>","pic_price":199,
     * "sharelink":"http://www.sdb330.com/Customization/237000630435",
     * "sharepic":"/Upload/Product/236000170128/36f2b4d047.jpg",
     * "shareintro":"毛衣定制就来衫点扮，衫点扮\u2014\u2014汇集全球好毛衣。",
     * "sharetitle":"快来看我的定制款，衫点扮有型--专属你的个性定制。",
     * "size":"XL|M|XXS|均码|S|XXL|XS|L",
     * "picz":"/Upload/Product/236000170128/Front/36f2b4d0c1.png",
     * "picf":"/Upload/Product/236000170128/Back/36f2b4d0c1.png"},
     * {"pic_id":"236001170125","pic_gender":"女装",
     * "pic_scr":"/Upload/Product/236001170125/36f2d355dc.jpg",
     * "pic_url":"api/Customization/GetDetail/236001170125",
     * "pic_title":"「Ur-color」拼接色毛衫定制","htmldetail":"<html><body
     * style='margin:0'><img src='http://www.sdb330
     * .com//Upload/Product/236001170125/37e126bed1.jpg' hidefocus='true'
     * style='width:100%' /><img src='http://www.sdb330
     * .com//Upload/Product/236001170125/36f2d355dd.jpg' hidefocus='true'
     * style='width:100%' /><\/body><\/html>","pic_price":199,
     * "sharelink":"http://www.sdb330.com/Customization/237000630456",
     * "sharepic":"/Upload/Product/236001170125/36f2d355d0.jpg",
     * "shareintro":"毛衣定制就来衫点扮，衫点扮\u2014\u2014汇集全球好毛衣。",
     * "sharetitle":"快来看我的定制款，衫点扮有型--专属你的个性定制。",
     * "size":"XXL|S|M|L|XXS|XL|均码|XS",
     * "picz":"/Upload/Product/236001170125/Front/36f2d355ff.png",
     * "picf":"/Upload/Product/236001170125/Back/36f2d355ff.png"}]}
     */

    private int error_code;
    private String error_msg;
    private int total;
    private DataBean data;

    public static StyleBean objectFromData(String str) {

        return new Gson().fromJson(str, StyleBean.class);
    }

    public static StyleBean objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), StyleBean
                    .class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<StyleBean> arrayStyleBeanFromData(String str) {

        Type listType = new TypeToken<ArrayList<StyleBean>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<StyleBean> arrayStyleBeanFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<StyleBean>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }

    public int getError_code() {
        return error_code;
    }

    public void setError_code(int error_code) {
        this.error_code = error_code;
    }

    public String getError_msg() {
        return error_msg;
    }

    public void setError_msg(String error_msg) {
        this.error_msg = error_msg;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public static class DataBean {
        /**
         * pic_id : 236000170128
         * pic_gender : 女装
         * pic_scr : /Upload/Product/236000170128/36f2b4d035.jpg
         * pic_url : api/Customization/GetDetail/236000170128
         * pic_title : 「Ur-color」拼接色开衫定制
         * htmldetail : <html><body style='margin:0'><img src='http://www
         * .sdb330.com//Upload/Product/236000170128/36f2b4d072.jpg'
         * hidefocus='true' style='width:100%' /></body></html>
         * pic_price : 199.0
         * sharelink : http://www.sdb330.com/Customization/237000630435
         * sharepic : /Upload/Product/236000170128/36f2b4d047.jpg
         * shareintro : 毛衣定制就来衫点扮，衫点扮——汇集全球好毛衣。
         * sharetitle : 快来看我的定制款，衫点扮有型--专属你的个性定制。
         * size : XL|M|XXS|均码|S|XXL|XS|L
         * picz : /Upload/Product/236000170128/Front/36f2b4d0c1.png
         * picf : /Upload/Product/236000170128/Back/36f2b4d0c1.png
         */

        private List<ListsBean> lists;

        public static DataBean objectFromData(String str) {

            return new Gson().fromJson(str, DataBean.class);
        }

        public static DataBean objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), DataBean
                        .class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<DataBean> arrayDataBeanFromData(String str) {

            Type listType = new TypeToken<ArrayList<DataBean>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<DataBean> arrayDataBeanFromData(String str, String
                key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<DataBean>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public List<ListsBean> getLists() {
            return lists;
        }

        public void setLists(List<ListsBean> lists) {
            this.lists = lists;
        }

        public static class ListsBean {
            private String pic_id;
            private String pic_gender;
            private String pic_scr;
            private String pic_url;
            private String pic_title;
            private String htmldetail;
            private double pic_price;
            private String sharelink;
            private String sharepic;
            private String shareintro;
            private String sharetitle;
            private String size;
            private String picz;
            private String picf;

            public static ListsBean objectFromData(String str) {

                return new Gson().fromJson(str, ListsBean.class);
            }

            public static ListsBean objectFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);

                    return new Gson().fromJson(jsonObject.getString(str),
                            ListsBean.class);
                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return null;
            }

            public static List<ListsBean> arrayListsBeanFromData(String str) {

                Type listType = new TypeToken<ArrayList<ListsBean>>() {
                }.getType();

                return new Gson().fromJson(str, listType);
            }

            public static List<ListsBean> arrayListsBeanFromData(String str,
                                                                 String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);
                    Type listType = new TypeToken<ArrayList<ListsBean>>() {
                    }.getType();

                    return new Gson().fromJson(jsonObject.getString(str),
                            listType);

                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return new ArrayList();


            }

            public String getPic_id() {
                return pic_id;
            }

            public void setPic_id(String pic_id) {
                this.pic_id = pic_id;
            }

            public String getPic_gender() {
                return pic_gender;
            }

            public void setPic_gender(String pic_gender) {
                this.pic_gender = pic_gender;
            }

            public String getPic_scr() {
                return pic_scr;
            }

            public void setPic_scr(String pic_scr) {
                this.pic_scr = pic_scr;
            }

            public String getPic_url() {
                return pic_url;
            }

            public void setPic_url(String pic_url) {
                this.pic_url = pic_url;
            }

            public String getPic_title() {
                return pic_title;
            }

            public void setPic_title(String pic_title) {
                this.pic_title = pic_title;
            }

            public String getHtmldetail() {
                return htmldetail;
            }

            public void setHtmldetail(String htmldetail) {
                this.htmldetail = htmldetail;
            }

            public double getPic_price() {
                return pic_price;
            }

            public void setPic_price(double pic_price) {
                this.pic_price = pic_price;
            }

            public String getSharelink() {
                return sharelink;
            }

            public void setSharelink(String sharelink) {
                this.sharelink = sharelink;
            }

            public String getSharepic() {
                return sharepic;
            }

            public void setSharepic(String sharepic) {
                this.sharepic = sharepic;
            }

            public String getShareintro() {
                return shareintro;
            }

            public void setShareintro(String shareintro) {
                this.shareintro = shareintro;
            }

            public String getSharetitle() {
                return sharetitle;
            }

            public void setSharetitle(String sharetitle) {
                this.sharetitle = sharetitle;
            }

            public String getSize() {
                return size;
            }

            public void setSize(String size) {
                this.size = size;
            }

            public String getPicz() {
                return picz;
            }

            public void setPicz(String picz) {
                this.picz = picz;
            }

            public String getPicf() {
                return picf;
            }

            public void setPicf(String picf) {
                this.picf = picf;
            }
        }
    }
}
